<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box {
        width: 600px;
        height: 300px;
    }
</style>

<body>
</body>
<script>
    let box1 = document.createElement("div");
    box1.innerText = "九九乘法表";
    box1.setAttribute("class", "box")
        //追加body
    document.body.appendChild(box1);
    // //九九乘法表
    let str = "";
    // 用来拼接
    for (let i = 1; i <= 9; i++) {
        for (let j = 1; j <= i; j++) {
            str = str + `${i}*${j}=${i*j} `;

        }
        let p = document.createElement("p");
        p.innerText = `${str}`;
        box1.appendChild(p);
        str = "";
        //  清楚字符串，为新的一轮做准备
    }
</script>

</html>